package com.cakebackoffice.View;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.Button;
import com.cakebackoffice.Model.OrderPriority;
import com.cakebackoffice.R;

public class PriorityButton extends Button {

    public PriorityButton(Context context, AttributeSet attrs) {
        super(context, attrs);
        setColor(OrderPriority.Normal);
    }

    public PriorityButton(Context context) {
        this(context, OrderPriority.Normal);
    }

    public PriorityButton(Context context, OrderPriority priority) {
        super(context);
        setColor(priority);
    }

    public void setColor(OrderPriority prior) {
        Resources res = getResources();
        if (prior.equals(OrderPriority.VHigh)) {
            Drawable shape = res.getDrawable(R.drawable.order5);
            this.setBackgroundDrawable(shape);
        }
        if (prior.equals(OrderPriority.High)) {
            Drawable shape = res.getDrawable(R.drawable.order4);
            this.setBackgroundDrawable(shape);
        }
        if (prior.equals(OrderPriority.Normal)) {
            Drawable shape = res.getDrawable(R.drawable.order3);
            this.setBackgroundDrawable(shape);
        }
        if (prior.equals(OrderPriority.Low)) {
            Drawable shape = res.getDrawable(R.drawable.order2);
            this.setBackgroundDrawable(shape);
        }
        if (prior.equals(OrderPriority.VLow)) {
            Drawable shape = res.getDrawable(R.drawable.order1);
            this.setBackgroundDrawable(shape);
        }
    }

}
